<?php 
session_start();
require_once 'mysql.php';
header('Content-Type:application/json');
$uname = $_POST['uname'];
$pwd = $_POST['pwd'];
$sql = "SELECT * FROM user WHERE (username='$uname') AND (password='$pwd')";
$result = $conn->query($sql);
$data = mysqli_fetch_array($result);
if($result->num_rows > 0){
	$_SESSION['uname']=$uname;
	header("location:HomePage.php");
}else{
	$_SESSION['login_error']='登录失败';
	header("location:login.php");
}
?>